package polymorphicTask.Pizza;

import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        PizzaFactory pizzaFactory=new PizzaFactory();
        System.out.print("请选择要制作的披萨：（1.培根披萨2.海鲜披萨）");
        Scanner in=new Scanner(System.in);
        int num1=in.nextInt();
        if (num1==1){
            System.out.println("请输入培根克数：");
            int num2=in.nextInt();
            System.out.print("请输入披萨大小：");
            String  size1=in.next();
            System.out.print("请输入披萨价格：");
            int price1=in.nextInt();
            Pizza pizza;
            pizza=pizzaFactory.producePizza("培根披萨");
            pizza.setName("培根披萨");
            pizza.setSize(size1);
            pizza.setPrice(price1);
            if (pizza instanceof BaconPizza){
                BaconPizza baconPizza=(BaconPizza)pizza;
                baconPizza.setWeight(num2);
            }
            pizza.show();
        }
        if (num1==2){
            System.out.println("请输入配料信息：");
            String dosing=in.next();
            System.out.print("请输入披萨大小：");
            String  size2=in.next();
            System.out.print("请输入披萨价格：");
            int price2=in.nextInt();
            Pizza pizza;
            pizza=pizzaFactory.producePizza("海鲜披萨");
            pizza.setName("海鲜披萨");
            pizza.setSize(size2);
            pizza.setPrice(price2);
            if (pizza instanceof SeafoodPizza){
                SeafoodPizza seafoodPizza=(SeafoodPizza)pizza;
                seafoodPizza.setDosing(dosing);
            }
            pizza.show();
        }
    }
}
